using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;

using System.ComponentModel.Design;

using System.Drawing;

using System.Drawing.Drawing2D;

using System.Workflow;

using System.Workflow.Activities;

using System.Workflow.ComponentModel;

using System.Workflow.ComponentModel.Design;



namespace MSNSearch.Activities
{
    /// <summary>

    /// Customize the activity's appearance on the designer

    /// </summary>

    [ActivityDesignerTheme(typeof(ConsoleActivityDesignerTheme))]

    public class ConsoleActivityDesigner : ActivityDesigner
    {

        readonly static Size BaseSize = new Size(107, 60);



        protected override Rectangle ImageRectangle
        {

            get { return CalcImageRectangle(); }

        }

        protected override Rectangle TextRectangle
        {

            get { return CalcTextRectangle(); }

        }



        protected override void Initialize(Activity activity)
        {

            base.Initialize(activity);

            Bitmap bmp = Properties.Resources.Custom_Activity_Background___Live_Find;

            //bmp.MakeTransparent();

            Image = bmp;

        }



        protected override Size OnLayoutSize(ActivityDesignerLayoutEventArgs e)
        {

            base.OnLayoutSize(e);

            return BaseSize;

        }



        private Rectangle CalcImageRectangle()
        {

            Rectangle bounds = Bounds;

            Size sz = new Size(107, 40);



            Rectangle rcImg = new Rectangle();

            rcImg.X = bounds.Left + ((bounds.Width - sz.Width) / 2);

            rcImg.Y = bounds.Top + 4;

            rcImg.Size = sz;

            return rcImg;

        }



        private Rectangle CalcTextRectangle()
        {

            Rectangle bounds = Bounds;

            Rectangle imgRect = ImageRectangle;

            Size sz = Image.Size;



            return new Rectangle(bounds.Left + 2, imgRect.Bottom,

               bounds.Width - 4, bounds.Height - imgRect.Height - 1);

        }



    } // class ConsoleActivityDesigner

 


}
